<template>
    <div class="wrap" id="expandrow">    
        <div class="table_wrap">
            <table>               
                <tbody>
                    <tr>
                        <td style="width:30%">渗透目标（IP）</td>
                        <td style="width:20%">协 议</td>
                        <td style="width:20%;">端 口</td>
                        <td style="width:30%">时 间</td>
                    </tr>
                    <tr v-for='(item, index) in table' :key="index">
                        <td style="width:30%">{{item.target_ip}}</td>
                        <td style="width:20%">{{item.target_port == 0 ? 'ICMP' : 'TCP'}}</td>
                        <td >{{item.target_port == 0 ? '-' : item.target_port}} {{showPort(item.target_port)}}</td>
                        <td style="width:30%">{{item.attack_time}}</td>
                    </tr>
                </tbody>
            </table>
        </div>
        <Page :total="Number(num)"  size="small" :page-size="25" @on-change = "getData" ></Page>
    </div>
</template>
<script>
    import attackType from 'libs/attackType'
    export default{
        props:{
            table: {
                required: true
            },
            num: {            
                required: true
            },
        },
        methods:{
            getData(page) {
                this.$emit("pageData",page)
            },
            showPort(value) {
                if (value==0) {
                    return ''
                }
                let val = attackType.value(value)
                if (val!=null) {
                    val = "( "+val+" )"
                } else {
                    val =''
                }
                return val
            }
        }
    }
</script>